package ro.k.servlets.order;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import ro.k.tags.ReqManopera;
import ro.k.web.beans.order.ReqManoperaBean;

/**
 * Servlet implementation class AddReqMan
 */
@WebServlet("/addReqMan")
public class AddReqMan extends HttpServlet {
	private static final long serialVersionUID = 1L;

	public AddReqMan() {
		super();

	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		HttpSession sess = request.getSession();

		String pg = request.getParameter("pagina");
		String valoare = request.getParameter("valoare").toString();
		String denumire = request.getParameter("denumire").toString();
		String durata = request.getParameter("durata").toString();

		ReqManopera tagReqMan = (ReqManopera) sess.getAttribute("tagReqMan");
		
		ReqManoperaBean rmb = new ReqManoperaBean(denumire, Double.valueOf(valoare), Double.valueOf(durata));
		
		tagReqMan.addReqMan(rmb);

		response.sendRedirect(request.getContextPath() + "/jsp/" + pg);
	}

}
